*Create single share figures*

*Load and append results datasets*
clear
use "Results\fig_B1\results_ambition.dta" 

gen type="ambition"

frame create temp
frame change temp

use "Results\fig_B1\results_educ.dta" 

gen type="educ"

frame create temp2
frame change temp2

use "Results\fig_B1\results_field.dta" 

gen type="field"

frame change default

frameappend temp
frameappend temp2

frame drop temp temp2

*Single shares

forvalues i=1(1)8{
gen male_`i'_sing_sh=(male_`i'_sing)/(male_`i'_marr+male_`i'_sing)
gen female_`i'_sing_sh=(female_`i'_sing)/(female_`i'_marr+female_`i'_sing)
}

**Male plots

*Fig B3a
twoway line male_1_sing_sh aar if type=="educ", lpattern(solid) lcolor(navy) || ///
line male_2_sing_sh aar if type=="educ", lpattern(dash) lcolor(maroon) || ///
line male_3_sing_sh aar if type=="educ", lpattern(shortdash) lcolor(dkorange) || ///
line male_4_sing_sh aar if type=="educ", lpattern(longdash) lcolor(teal) ///
xtitle("year") ytitle("single shares") ///
legend(rows(2) cols(2) order(1 "Primary" 2 "Secondary" 3 "Bachelor" 4 "Master & PhD") position(6)) ///
graphregion(fcolor(white)) yscale(range(0 0.7)) ylabel(0(0.1)0.7)

*Fig B3c
twoway line male_1_sing_sh aar if type=="ambition", lpattern(solid) lcolor(teal) || ///
line male_2_sing_sh aar if type=="ambition", lpattern(longdash) lcolor(navy)  || ///
line male_3_sing_sh aar if type=="ambition", lpattern(shortdash) lcolor(dkorange) || ///
line male_4_sing_sh aar if type=="ambition", lpattern(dash) lcolor(maroon) ///
xtitle("year") ytitle("single shares") ///
legend(rows(2) cols(2) order(1 "(low w{sub:0}, low g)" 3 "(low w{sub:0}, high g)" 2 "(high w{sub:0}, low g)" 4 "(high w{sub:0}, high g)") position(6)) ///
graphregion(fcolor(white)) yscale(range(0 0.7)) ylabel(0(0.1)0.7)


*Fig B3e
twoway line male_3_sing_sh aar if type=="field", lpattern(solid) lcolor(teal) || ///
line male_4_sing_sh aar if type=="field", lpattern(dash) lcolor(maroon) || ///
line male_5_sing_sh aar if type=="field", lpattern(shortdash) lcolor(lavender) || ///
line male_6_sing_sh aar if type=="field", lpattern(longdash) lcolor(navy) || ///
line male_7_sing_sh aar if type=="field", lpattern(dash_dot) lcolor(dkorange) ///
xtitle("year") ytitle("single shares") ///
legend(order(1 "Humanities" 5 "Health" 2 "Social Science" 4 "STEM" 3 "Business") cols(4) rows(2) position(6)) ///
graphregion(fcolor(white)) yscale(range(0 0.7)) ylabel(0(0.1)0.7)

**Female plots

*Fig B3b
twoway line female_1_sing_sh aar if type=="educ", lpattern(solid) lcolor(navy) || ///
line female_2_sing_sh aar if type=="educ", lpattern(dash) lcolor(maroon) || ///
line female_3_sing_sh aar if type=="educ", lpattern(shortdash) lcolor(dkorange) || ///
line female_4_sing_sh aar if type=="educ", lpattern(longdash) lcolor(teal) ///
xtitle("year") ytitle("single shares") ///
legend(rows(2) cols(2) order(1 "Primary" 2 "Secondary" 3 "Bachelor" 4 "Master & PhD") position(6)) ///
graphregion(fcolor(white)) yscale(range(0 0.7)) ylabel(0(0.1)0.7)

*Fig B3d
twoway line female_1_sing_sh aar if type=="ambition", lpattern(solid) lcolor(teal) || ///
line female_2_sing_sh aar if type=="ambition", lpattern(longdash) lcolor(navy)  || ///
line female_3_sing_sh aar if type=="ambition", lpattern(shortdash) lcolor(dkorange) || ///
line female_4_sing_sh aar if type=="ambition", lpattern(dash) lcolor(maroon) ///
xtitle("year") ytitle("single shares") ///
legend(rows(2) cols(2) order(1 "(low w{sub:0}, low g)" 3 "(low w{sub:0}, high g)" 2 "(high w{sub:0}, low g)" 4 "(high w{sub:0}, high g)") position(6)) ///
graphregion(fcolor(white)) yscale(range(0 0.7)) ylabel(0(0.1)0.7)


*Fig B3f
twoway line female_3_sing_sh aar if type=="field", lpattern(solid) lcolor(teal) || ///
line female_4_sing_sh aar if type=="field", lpattern(dash) lcolor(maroon) || ///
line female_5_sing_sh aar if type=="field", lpattern(shortdash) lcolor(lavender) || ///
line female_6_sing_sh aar if type=="field", lpattern(longdash) lcolor(navy) || ///
line female_7_sing_sh aar if type=="field", lpattern(dash_dot) lcolor(dkorange) ///
xtitle("year") ytitle("single shares") ///
legend(order(1 "Humanities" 5 "Health" 2 "Social Science" 4 "STEM" 3 "Business") cols(4) rows(2) position(6)) ///
graphregion(fcolor(white)) yscale(range(0 0.7)) ylabel(0(0.1)0.7)

